#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main() {
    int n, t;
    int j = 0;
    int arr[50] = { 0 };
    scanf("%d", &n);
    for (int i = 0; i < n; ++i)
    {
        scanf("%d ", &arr[i]);
    }
    scanf("%d", &t);
    while (j != n)
    {
        if (arr[j] == t)
        {
            for (int i = j; i < n - 1; ++i)
            {
                arr[i] = arr[i + 1];
            }
            n--;
        }
        else {
            j++;
        }
    }
    for (int i = 0; i < j; ++i)
    {
        printf("%d ", arr[i]);
    }
    return 0;
}